module.exports = function ($scope, $resource, $modal, toaster) {

	//游客信息列表
	$scope.search = function(pageNo) {
		var para = {
			'pageNo': pageNo || $scope.currentPage,
			'pageSize': $scope.itemsPerPage,
			'name': $scope.searchform.name,
			'card_code': $scope.searchform.card_code,
		}
		$resource('/api/as/atc/tourist/getTouristList', {}, {}).save(para, function(res){
            if (res.errcode === 0) {
				$scope.touristList = res.data.results;
				$scope.totalItems = res.data.totalRecord;
				$scope.currentPage = pageNo;
            } else {
                toaster.error({title: '', body: '查询游客信息失败'});
            }
        });
	}

	init();
	function init(){
		$scope.currentPage = 1;			//当前页码
		$scope.itemsPerPage = 20;		//每页显示几条
		$scope.searchform = {};
		$scope.search(1);
	}

	//游客的出游信息
	$scope.getGroupInfo = function(item) {
		var modalInstance = $modal.open({
			template: require('../views/touristTravel.html'),
			controller: 'touristTravel',
			size: 'lg',
			resolve: {
				item: function () {
					return item;
				}
			}
		});
	}

};